package com.example.shiyan2;

import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

import androidx.appcompat.app.AppCompatActivity;

public class OneActivity extends AppCompatActivity {

    Button xx,cz,kz,back;
    LinearLayout ll;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_one);
        xx = findViewById(R.id.xx);
        cz = findViewById(R.id.cz);
        kz = findViewById(R.id.kz);
        ll = findViewById(R.id.ll);
        xx.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ll.setOrientation(LinearLayout.HORIZONTAL);
            }
        });
        cz.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ll.setOrientation(LinearLayout.VERTICAL);
            }
        });
        kz.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
//                xx.setGravity(Gravity.LEFT);
//                cz.setGravity(Gravity.LEFT);
//                kz.setGravity(Gravity.LEFT);
//                xx.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
//                cz.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
                ll.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
                ll.setOrientation(LinearLayout.VERTICAL);
                ll.setHorizontalGravity(Gravity.CENTER);

            }
        });
        back = findViewById(R.id.back);
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });




    }
}